package com.lxw.manage_cms.service;

import com.lxw.framework.domain.cms.CmsConfig;
import com.lxw.framework.exception.BizException;
import com.lxw.framework.model.response.CommonCode;
import com.lxw.manage_cms.dao.CmsConfigDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class CmsConfigService {
    @Autowired
    CmsConfigDao cmsConfigDao;
    public CmsConfig fingById(String id){
        Optional<CmsConfig> byId = cmsConfigDao.findById(id);
        if (byId.isPresent()){
            return byId.get();
        }
        // 查询失败 抛出异常
        throw new BizException(CommonCode.SERVER_ERROR);
    }
}
